package com.example.domain;

import java.util.Date;
import java.util.Objects;


public class t_article {
    private int id;
    private int allow_comment; //是否允许评论
    private String title; //文章题目
    private String content; //文章内容
    private String categories;  //文章分类
    private String tags;  //文章标签
    private String thumbnail;  //文章缩略图
    private int user_id; //文章所属用户
    Date created;  //创建时间
    Date modified; //最近修改时间
    private Integer hits,comments_num;       // 点击 评论总量
    private String username;  //文章所属用户
    private boolean secret;

    public boolean isSecret() {
        return secret;
    }

    public void setSecret(boolean secret) {
        this.secret = secret;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getHits() {
        return hits;
    }

    public void setHits(Integer hits) {
        this.hits = hits;
    }

    public Integer getComments_num() {
        return comments_num;
    }

    public void setComments_num(Integer commentsNum) {
        this.comments_num = commentsNum;
    }

    public t_article() {
    }
    public t_article(int id) {
        this.id=id;
    }

    public t_article(int id, int allow_comment, String title, String content,
                     String categories, String tags, String thumbnail, Date created,
                     Date modified) {
        this.id = id;
        this.allow_comment = allow_comment;
        this.title = title;
        this.content = content;
        this.categories = categories;
        this.tags = tags;
        this.thumbnail = thumbnail;
        this.created = created;
        this.modified = modified;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        t_article t_article = (t_article) o;
        return id == t_article.id && allow_comment == t_article.allow_comment && user_id == t_article.user_id && secret == t_article.secret && Objects.equals(title, t_article.title) && Objects.equals(content, t_article.content) && Objects.equals(categories, t_article.categories) && Objects.equals(tags, t_article.tags) && Objects.equals(thumbnail, t_article.thumbnail) && Objects.equals(created, t_article.created) && Objects.equals(modified, t_article.modified) && Objects.equals(hits, t_article.hits) && Objects.equals(comments_num, t_article.comments_num) && Objects.equals(username, t_article.username);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, allow_comment, title, content, categories, tags, thumbnail, user_id, created, modified, hits, comments_num, username, secret);
    }

    @Override
    public String toString() {
        return "t_article{" +
                "id=" + id +
                ", allow_comment=" + allow_comment +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", categories='" + categories + '\'' +
                ", tags='" + tags + '\'' +
                ", thumbnail='" + thumbnail + '\'' +
                ", user_id=" + user_id +
                ", created=" + created +
                ", modified=" + modified +
                ", hits=" + hits +
                ", comments_num=" + comments_num +
                ", username='" + username + '\'' +
                ", secret=" + secret +
                '}';
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getAllow_comment() {
        return allow_comment;
    }

    public void setAllow_comment(int allow_comment) {
        this.allow_comment = allow_comment;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCategories() {
        return categories;
    }

    public void setCategories(String categories) {
        this.categories = categories;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getModified() {
        return modified;
    }

    public void setModified(Date modified) {
        this.modified = modified;
    }
}
